const goldpriceWebSocket = new WebSocket("ws://localhost:8081/goldprice/ws");

const goldpriceWS = {
    onopen(cb) {
        goldpriceWebSocket.onopen = evt => {
            console.log("Connection open for get price from Gold_Price");
            goldpriceWebSocket.send("start");
            cb();
        };
    },

    onmessage(cb) {
        goldpriceWebSocket.onmessage = evt => {
            console.log("Gold_Price USD_XAU: " + evt.data);
            cb(evt.data);
        };
    },

    send(data) {
        goldpriceWebSocket.send(data)
    }

}

// export { ws };